﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Diagnostics;
using System.Linq;
using System.ServiceProcess;
using System.Text;
using System.Threading;
using System.Threading.Tasks;

namespace PBO.RoomService
{
    public partial class Service1 : ServiceBase
    {
        public Service1()
        {
            InitializeComponent();
        }

        protected override void OnStart(string[] args)
        {
            while (RoomHelper.RunServer() == false) Thread.Sleep(1000 * 10);
        }

        protected override void OnStop()
        {
            if (RoomHelper._server != null)
            {
                RoomHelper._server.Dispose();
                RoomHelper._server = null;
            }
        }
    }
}
